package cn.edu.dgut.experiment2.config;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

public class CustomCommandlineRunner implements CommandLineRunner {

    private Environment env;

    public  CustomCommandlineRunner(Environment env){
        this.env = env;
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("springboot 自动装配runner");
        System.out.println("生成一个随机的字符串：".concat(Objects.requireNonNull(env.getProperty("random."))));
    }
}
